
local buff = ac.buff['演出时间']
buff.cover_type = 1

function buff:on_add()
    local unit = self.owner
    unit:add_restriction '隐藏'
    unit:add_restriction '无敌'
    unit:add_restriction '硬直'
    self:gc(function()
        unit:remove_restriction '隐藏'
        unit:remove_restriction '无敌'
        unit:remove_restriction '硬直'
    end)
end

--[[
地下升高
]]

local buff = ac.buff['Boss出场']
buff.model2 = [[4ba42c4078ddc07409f0afed579f495d.mdl]]
buff.time = 4
buff.fade = 1
buff.pulse = 0.03
function buff:on_pulse()
    local h = math.min(- ((self:get_remaining())/(self.time - self.fade)) * 400,0)
    self.effect:set_height(h + self.height)
end

function buff:on_add()
    local unit = self.owner
    local point = unit:get_point()
    self.height = point:get_height()
    ac.player.self:noise(5,self.time)
    self.effect = point:effect{
        model = unit:get_model(),
        size = unit:get_slk('modelScale',1) * (unit['模型大小'] or 1),
        hide_when_remove = true,
        angle = 270,
    }
    self:on_pulse()
    self:gc(unit:add_buff '演出时间'{})
    self:gc(self.effect)
    self:gc(point:effect{
        model = self.model2,
        size = 1,
    })
end


--[[
投射出场
]]

local buff = ac.buff['分离演出']
buff.distance = 500
buff.speed = 400
buff.arc = 0.5
buff.size = 2
buff.model = [[Abilities\Weapons\GreenDragonMissile\GreenDragonMissile.mdl]]
function buff:on_add()
    local hero = self.owner
    local point = hero:get_point() - {math.random(360),self.distance}
    self:gc(hero:add_buff '演出时间'{})
    ac.mover('point')
    {
        start = hero:get_launch_point(),
        target = point,
        speed = self.speed,
        arc = self.arc,
        size = self.size,
        block = true,
        model = self.model,
        on_move = function(_,point)
            return point:is_flyable()
        end,
        on_remove = function(mvr)
            local point = mvr:get_point()
            hero:set_point(point)
            self:remove()
        end
    }
end



local mt = ac.buff['挑战限时']
mt.pulse = 1

function mt:on_pulse()
    local unit = self.owner
    unit.ui_title = ('%s(|cffffff00%0.f|r)'):format(unit.title or unit.name,self:get_remaining())
end

function mt:on_add()
    local unit = self.owner
    self:on_pulse()
    self:gc(function()
        if self:get_remaining()<=0 then
            unit:remove()
        end
    end)
end